package cn.maidouya.hrm.mapper;

import cn.maidouya.hrm.domain.LoginUser;
import cn.maidouya.hrm.domain.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LongUserMapper {
    @Select("SELECT * FROM t_login_user WHERE username =#{username}")
    LoginUser loadUserByUsername(String username);
    @Select("SELECT t3.* FROM t_user_role t1 \n" +
            "LEFT JOIN t_role_permission t2 on t1.role_id = t2.role_id\n" +
            "LEFT JOIN t_permission t3 on t2.permission_id = t3.id\n" +
            "WHERE t1.user_id = #{id}")
    List<Permission> getByIdPermission(Long id);
}
